package com.peixian.exception;


import com.peixian.enums.BaseResultEnums;
import lombok.Data;

/**
 * 自定义基础异常，用于向上跑出可预知异常
 *
 * @author huangxl
 * @create 2018-11-12 11:09
 */
@Data
public class BaseException extends RuntimeException {
    protected int code;
    protected String msg;

    public BaseException() {
        this(BaseResultEnums.DEFAULT);
    }

    public BaseException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseException(BaseResultEnums rs) {
        this.code = rs.getCode();
        this.msg = rs.getCnmsg();
    }

}